@extends('admin/layout')

@section('content')
    <div class="content-wrapper">
        <section>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li class="active">修改用户信息</li>
            </ol>
        </section>
        <div class="content-wrapper">
            <section class="content">
                <div class="row">
                    <div class="col-md-6">
                        <div class="box box-info"  style="width: 60%; margin-left: -200px; padding-bottom:8px">
                            <div class="box-header with-border">
                                <span id="msg" style="display: none">
                    @if (count($errors) > 0)
                                        @foreach ($errors->all() as $error)
                                            <div style="width: 100%;">
                                <span style="color: red;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ $error }}</span>
                            </div>
                                        @endforeach
                                    @else
                                        <div style="width: 100%;">
                            <span style="color: green;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ Session::get('msg') }}</span>
                        </div>
                                    @endif
                </span>
                                <script type="text/javascript">
                                    var _msg = $('#msg div span').text();
                                    console.log(_msg);
                                    if(_msg != ''){
                                        layer.msg(_msg);
                                    }
                                </script>
                                <form action="{{ url('admin/edit') }}" method="post" class="form-horizontal">
                                    {{ csrf_field() }}
                                    <div class="box-body">
                                        <div class="form-group">
                                            <label for="inputEmail3" class="col-sm-2 control-label">用户名：</label>
                                            <input type="hidden" name="id" value="{{ $list->id }}">
                                            <div class="col-sm-10">
                                                <input type="text" name="username" class="form-control" id="inputEmail3" value="{{ $list->username }}" placeholder="" >
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label for="inputEmail3" class="col-sm-2 control-label">角色名称：</label>

                                            <div class="col-sm-10">
                                                <input type="text" name="roleid" class="form-control" id="inputEmail3" value="{{ App\Role::find($list->roleid)['name'] }}" disabled>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="inputEmail3" class="col-sm-2 control-label">联系电话：</label>

                                            <div class="col-sm-10">
                                                <input type="text" name="phone" class="form-control" id="inputEmail3" value="{{ $list->phone }}" placeholder="phone">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="inputEmail3" class="col-sm-2 control-label">邮箱：</label>

                                            <div class="col-sm-10">
                                                <input type="text" name="email" class="form-control" id="inputEmail3" value="{{ $list->email }}" placeholder="">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="inputEmail3" class="col-sm-2 control-label">更改密码：</label>

                                            <div class="col-sm-10">
                                                <input type="password" name="pass" class="form-control" id="inputEmail3" value="" placeholder="">
                                            </div>
                                        </div>
                                    </div>
                                    <!-- /.box-body -->
                                    <div class="box-footer">
                                        <button type="submit" class="btn btn-info pull-right">保存</button>
                                    </div>
                                    <!-- /.box-footer -->
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </div>

@stop